C*********************************************************************C
C*                                                                   *C
C*  chapacc.for                                                      *C
C*                                                                   *C
C*  Written by:  David L. Huestis, Molecular Physics Laboratory      *C
C*                                                                   *C
C*  Copyright (c) 2000  SRI International                            *C
C*  All Rights Reserved                                              *C
C*                                                                   *C
C*  This software is provided on an as is basis; without any         *C
C*  warranty; without the implied warranty of merchantability or     *C
C*  fitness for a particular purpose.                                *C
C*                                                                   *C
C*********************************************************************C
C*
C*	To graph the worst-case accuracy, chi=0,90 degrees, of Chapman 
C*	Function approximations vs X
C*
C*  USAGE:
C*
C*	FORTRAN chapacc.for
C*	FORTRAN chapman.for
C*	FORTRAN chaplit.for
C*	LINK chapacc+chapman+chaplit
C*	chapacc > chapacc.out
C*	GRA .lgo chapacc.kvs
C*
C*  EDIT HISTORY:
C*
C*	01/29/2000 DLH	Released version
C*
C**********************************************************************

	implicit real*8(a-h,o-z)
	real*4 atm_chap_num
	parameter (nc=4)
	dimension calc(nc), err(nc), ichi(nc)

	do i=1,201,5
	  X = i
	  do k=1,nc
	    ichi(k) = 0
	    err(k) = 0
	  end do
	  chi1 = 0
	  err1 = 0
	  DO j=1,89,2
	    chi0 = j
	    calc(1) = atm8_chap_asy(X,chi0)
	    calc(2) = atm8_chap_deq(X,chi0)
	    calc(3) = atm_chap_num(sngl(X),sngl(chi0))
	    calc(4) = atm8_chap_Ch31b(X,chi0)
	    truth = atm8_chap_num(X,chi0)
	    do k=1,nc
	      errt = abs(truth-calc(k))/truth
	      if( errt .gt. err(k) ) then
	        err(k) = errt
	        ichi(k) = j
	      end if
	    end do
	  end do
	  write(*,2300)X,(ichi(k),err(k),k=1,nc)
	end do
2300	format(f8.3,8(i3,1pd10.3))
	end